import Mock from 'mockjs';
export default {
  'GET /api/su': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      data: {
        [`dataList|${10}`]: [
          {
            suId: '@name',
            fsuTypeId: 1,
            ip: '127.0.0.1',
            port: 8081,
            createTime: '2020-02-26 10:15:22',
            updateTime: '2020-02-26 10:16:31',
          },
        ],
        totalCount: 1,
      },
      errorCode: null,
    });
    res.send(data);
  },
  'GET /api/custom/all': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      'data|6': [
        {
          'id|+1': 1,
          name: '@cname',
          code: '101',
          requestXml:
            '<html style="color:green"><!--thisisacomment--><head><title>HTMLExample</title></head><body>Theindentationtriestobe<em>somewhat&quot;dowhatImean&quot;</em>...butmightnotmatchyourstyle.</body></html>',
          responseXml:
            '<html style="color:green"><!--thisisacomment--><head><title>HTMLExample</title></head><body>Theindentationtriestobe<em>somewhat&quot;dowhatImean&quot;</em>...butmightnotmatchyourstyle.</body></html>',
          fsuTypeId: null,
          createTime: '2020-02-26 09:01:24',
          updateTime: '2020-02-26 09:09:04',
        },
      ],
      errorCode: null,
    });
    res.send(data);
  },
  'GET /api/device/queryDevice': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      'data|12': [
        {
          'id|+1': 1,
          name: '@cname',
        },
      ],
      errorCode: null,
    });
    res.send(data);
  },
  'GET /api/sp/querySpData': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      'data|13': [
        {
          'spId|+1': 1,
          spName: '@cname',
          spTypeId: '@id',
          spTypeName: '@cname',
          value: '@natural(60, 100)',
          reportTime: 1584686190,
        },
      ],
      errorCode: null,
    });
    res.send(data);
  },
  'DELETE api/su/:id': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      data: null,
      errorCode: null,
    });
    res.send(data);
  },
  'POST /api/command/startFlow': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      data: null,
      errorCode: null,
    });
    res.send(data);
  },
  'POST /api/su/updateInfo': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      'data|2': [
        {
          id: 1,
          name: '广东',
          mask: '',
        },
        {
          id: 2,
          name: '北京',
          mask: '',
        },
      ],
      errorCode: null,
    });
    res.send(data);
  },
  'GET /api/log': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      'data|2': {
        name: '@cname',
        request: '',
        response: '',
        customName: '校时',
        customType: 0,
        time: 1584668081,
        id: '@id',
      },
      errorCode: null,
    });
    res.send(data);
  },
  'GET /api/custom/:id': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      'data|2': {
        name: '@cname',
        id: '@id',
        first: '@first',
        last: '@last',
      },
      errorCode: null,
    });
    res.send(data);
  },
  'GET /api/deviceFlowStatus/query': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      data: [20],
      errorCode: null,
    });
    res.send(data);
  },
  'POST /api/deviceFlowStatus/setUp': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      data: {
        suIndex: 17,
        flows: [20, 21],
      },
      errorCode: null,
    });
    res.send(data);
  },
  'GET /api/flow/all': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      'data|6': [{ 'id|+1': 0, name: '@cname' }],
      errorCode: null,
    });
    res.send(data);
  },
  'POST /api/command': (req, res) => {
    let data = Mock.mock({
      result: true,
      msg: null,
      data: {
        customName: '@cname',
        'customType|1': [0, 1],
        'time|1564577990837-2564577990837': 0,
        request:
          '<Request><PK_Type><Name>ASK_SCHEMECONFIG</Name><Code>201</Code></PK_Type><Info><SUID>00-EF-10-A0-22-98</SUID></Info></Request>',
        response:
          '<Response><PK_Type><Name>ASK_SCHEMECONFIG_ACK</Name><Code>202</Code></PK_Type><Info><SUID>00-EF-10-A0-22-98</SUID><Result>FAILURE</Result><FailureCode>NOFILE_ERROR</FailureCode><FailureCause>找不到SU配置方案表</FailureCause></Info></Response>',
      },
      errorCode: null,
    });
    res.send(data);
  },
};
